package com.yfp.operation.api;

import com.yfp.common.core.constant.ServiceNameConstants;
import com.yfp.common.core.domain.R;
import com.yfp.operation.api.factory.RemoteOperationFallbackFactory;
import com.yfp.operation.domain.*;
import com.yfp.operation.domain.EnterpriseOrderDeliveryPlanDTO;
import com.yfp.operation.domain.OrderComboGroupDTO;
import com.yfp.operation.domain.Receiver;
import com.yfp.operation.domain.RedisOrderDetail;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * operation运营模块
 *
 * @author ruoyi
 */
@FeignClient(contextId = "remoteOperationService", value = ServiceNameConstants.OPERATION_SERVICE, fallbackFactory = RemoteOperationFallbackFactory.class)
public interface RemoteOperationService {

    @GetMapping("/job/check/meal/anomaly")
    R<Void> checkMachineMealAnomaly();

    @GetMapping("/job/orderBill/carryto")
    R<Void> orderBillCarryto();

    @GetMapping("/job/provider/withdraw")
    R<Void> providerWithdraw();

    @GetMapping("/job/orderBill/autoMakePayment")
    R<Void> autoMakePayment();

    @PostMapping("/job/check/meal/min/anomaly")
    R<Void> checkMachineMealMinAnomaly(@RequestBody List<RedisOrderDetail> redisOrderDetails);

    @GetMapping("/job/marAssociation/syncGroupChat")
    R<Void> syncGroupChat();

    @GetMapping("/job/mar/status")
    R<Void> marCall();

    @GetMapping("/job/check/couponPack/status")
    R<Void> checkCouponPackAndUpdateAllStatus();

    @GetMapping("/job/client/label")
    R<Void> clientLabel();

    @GetMapping("/job/check/activitySignIns/status")
    R<Void> checkActivitySignInsAndUpdateAllStatus();

    @Operation(summary = "检测并更新所有抽奖活动状态")
    @GetMapping("/job/check/lottery/status")
    public R<Void> checkLotteryAndUpdateAllStatus();
    /**
     * 订单分成
     *
     * @param orderSn
     * @param payType
     * @return
     */
    @GetMapping("/userBill/order/routing")
    R<Void> orderRouting(@RequestParam("orderSn") String orderSn, @RequestParam("payType") Integer payType);

    /**
     * 订单分成是否提现
     *
     * @param orderSn
     * @return
     */
    @Operation(summary = "订单分成是否提现", description = "退款服务使用")
    @GetMapping("/userBill/order/withdraw")
    R<Boolean> orderWithdraw(@RequestParam("orderSn") String orderSn);

    /**
     * 订单退款扣除之前的分成
     *
     * @param orderSn
     * @param amountOfMoney
     * @return
     */
    @GetMapping("/userBill/order/reimburse")
    R<Void> orderReimburse(@RequestParam("orderSn") String orderSn, @RequestParam("refundMoney") BigDecimal amountOfMoney);

    @PostMapping("/device/order/min/make")
    R<Boolean> orderMinMake(@RequestParam("orderId") String orderId);

    /**
     * 添加分账关系
     *
     * @param receivers
     * @return
     */
    @PostMapping("/wx/addReceiver")
    R<Void> addReceiver(List<Receiver> receivers);

    /**
     * 定时修改计划组为结束状态
     *
     * @return
     */
    @PutMapping("/placement_plan/plan/status")
    R<Void> updatePlanStatus();

    /**
     * 后台退优惠券
     *
     * @return
     */
    @GetMapping("/client/coupon/order/refund")
    R<Void> refundClientCoupon(@RequestParam("orderListId") String orderListId);

    /**
     * 邀请好友送优惠券
     *
     * @return
     */
    @GetMapping("marActivity/issue/invite/coupon")
    R<Void> issueInviteCouponForHost(@RequestParam("passiveClientId") String passiveClientId);


    /**
     * 定时修改套餐计划为结束状态
     *
     * @return
     */
    @PutMapping("/placement_plan/combo_plan/timing")
    R<Void> updateComboPlanStatus();

    /**
     * 套餐参与校验
     *
     * @return
     */
    @GetMapping("/marCoupon/check/combo/participation")
    R<Boolean> checkComboParticipation(@RequestParam("comboId") String comboId);

    /**
     * 删除运营人员
     *
     * @return
     */
    @DeleteMapping("/personal/machine/delete")
    R<Void> delOperationUser(@RequestParam("operationUserId") Long operationUserId, @RequestParam("machines") List<String> machines);

    @PostMapping("/order/group/status")
    @Operation(summary = "获取订单状态", description = "H5-团餐页面使用")
    R<List<OrderComboGroupDTO>> listGroupOrderInfo(@RequestBody List<String> orderSn);


    @PostMapping("/auto/enterprise/placementPlan")
    @Operation(summary = "根据企业订单生成投放计划")
    R<Void> autoEnterprisePlacementPlan(@RequestBody EnterpriseOrderDeliveryPlanDTO enterpriseOrderVO);

    @DeleteMapping("/del/enterprise/placementPlan")
    @Operation(summary = "删除企业订单生成投放计划")
    R<Void> delEnterprisePlacementPlan(String machineId);

    @PostMapping("/lottery/lotteryCount")
    @Operation(summary = "增加抽奖次数")
    public R<Void> lotteryCount(@RequestParam("clientId") String clientId, @RequestParam("price") String price, @RequestParam("cityName") String cityName);

    @PostMapping("/activity-sign-ins/incrementCount")
    @Operation(summary = "增加打卡次数")
    R<Void> activitySignInsCount(@RequestParam("clientId") String userId, @RequestParam("cityName") String cityName);

    @PutMapping("/stored/expire")
    @Operation(summary = "储值活动到期失效")
    R<Void> storedActivityExpire();

    @PutMapping("/client/coupon/storedCoupon/expire")
    @Operation(summary = "储值活动优惠券失效")
    R<Void> storedCouponExpire(@RequestParam("cbId") Long cbId);

    @PutMapping("/job/client/coupon/storedCoupon/expire")
    @Operation(summary = "给进社群的新客户打点位标签")
    R<Void> newClientPositionLabel();

    @PostMapping("/opclient/updatePositionId")
    @Operation(summary = "修改客户点位标签")
    R<Void> updatePositionId(@RequestParam("orderId") String orderId);

    @PostMapping("/clientIntegral/giveIntegral")
    @Operation(summary = "赠送积分")
    R<Void> giveIntegral(@RequestParam("orderId") String orderId);
}
